package com.jin.blog.controller.admin;

import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Page;
import com.jin.blog.interceptor.SessionInterceptor;
import com.jin.blog.pojo.Message;
@Before(SessionInterceptor.class)
public class MessageController extends Controller {

	public void index() {
		Integer pageNum = getParaToInt("p", 1);
		Page<Message> page = Message.dao.paginate(pageNum, 10, "select *",
				"from message order by dateTime desc");
		setAttr("page", page);
		render("messageList.html");
	}
	
	public void delete(){
		Message.dao.deleteById(getParaToInt(0));
		redirect("/admin/message/");
	}
}
